package com.shop.core.init;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

import com.shop.service.UserService;

/**
 * 基础数据初始化
 * 
 * @author Shine
 *
 */
@Component
public class BaseInit implements InitializingBean {

	@Resource
	private UserService seivce;// 属性。和配置文件对应property name对应

	public UserService getUserService() {
		return seivce;
	}

	private static final Logger log = Logger.getLogger(BaseInit.class);

	/**
	 * 做缓存，初始化数据库数据
	 */

	@Override
	public void afterPropertiesSet() throws Exception {
		log.debug("test");
		log.info("初始化数据");
		log.warn(this.getUserService().getUserById(1).getLoginName());
	}
}
